<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Pluginstate extends Base{
    public function pluginstate(){
        if(!empty(input("param.plugin_id"))){
            $plugin_id=input("param.plugin_id");
        }else{
            return json(['code' => 501, 'msg' => '插件id呢']);exit();
        }
        if(!empty(input("param.url"))&&input("param.url")==$_SERVER['HTTP_HOST']){
        }else{
            return json(['code' => 502, 'msg' => '域名不对']);exit();
        }
        $res=Db::name('pluginapp')->where('id',$plugin_id)->update(['buy_state'=>1]);
        if($res){
            return json(['code' => 200, 'msg' => '成功！']);exit();
        }else{
            return json(['code' => 500, 'msg' => '失败！']);exit();
        }
    }
}